import type { PageParam, PageResult } from '@vben/request';

import { requestClient } from '#/api/request';

export namespace VolunteerApplyApi {
  /** 志愿者/师资注册申请信息 */
  export interface VolunteerApply {
    id?: number;
    communityId?: number;
    userId: number;
    personId?: number;
    applyType?: number;
    realName: string;
    gender?: number;
    age?: number;
    phone: string;
    idCard?: string;
    education?: string;
    occupation?: string;
    skills?: string;
    idCardFront?: string;
    idCardBack?: string;
    certificate?: string;
    applyReason?: string;
    availableTime?: string;
    auditStatus?: number;
    auditUserId?: number;
    auditTime?: string;
    auditRemark?: string;
    status?: number;
    remark?: string;
    createTime?: string;
  }

  /** 志愿者/师资注册申请分页查询参数 */
  export interface VolunteerApplyPageReqVO extends PageParam {
    communityId?: number;
    userId?: number;
    personId?: number;
    applyType?: number;
    realName?: string;
    gender?: number;
    phone?: string;
    auditStatus?: number;
    createTime?: string[];
  }
}

/** 查询志愿者/师资注册申请分页 */
export function getVolunteerApplyPage(params: VolunteerApplyApi.VolunteerApplyPageReqVO) {
  return requestClient.get<PageResult<VolunteerApplyApi.VolunteerApply>>(
    '/cmt/person-volunteer-apply/page',
    { params },
  );
}

/** 查询志愿者/师资注册申请详情 */
export function getVolunteerApply(id: number) {
  return requestClient.get<VolunteerApplyApi.VolunteerApply>(
    `/cmt/person-volunteer-apply/get?id=${id}`,
  );
}

/** 新增志愿者/师资注册申请 */
export function createVolunteerApply(data: VolunteerApplyApi.VolunteerApply) {
  return requestClient.post('/cmt/person-volunteer-apply/create', data);
}

/** 修改志愿者/师资注册申请 */
export function updateVolunteerApply(data: VolunteerApplyApi.VolunteerApply) {
  return requestClient.put('/cmt/person-volunteer-apply/update', data);
}

/** 删除志愿者/师资注册申请 */
export function deleteVolunteerApply(id: number) {
  return requestClient.delete(`/cmt/person-volunteer-apply/delete?id=${id}`);
}

/** 批量删除志愿者/师资注册申请 */
export function deleteVolunteerApplyList(ids: number[]) {
  return requestClient.delete(
    `/cmt/person-volunteer-apply/delete-list?ids=${ids.join(',')}`,
  );
}

/** 导出志愿者/师资注册申请 */
export function exportVolunteerApply(params: any) {
  return requestClient.download('/cmt/person-volunteer-apply/export-excel', { params });
}
